package com.ruoyi.slope.warning.method.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.slope.warning.method.mapper.SlopeWarningMethodMapper;
import com.ruoyi.slope.warning.method.domain.SlopeWarningMethod;
import com.ruoyi.slope.warning.method.service.ISlopeWarningMethodService;

/**
 * 预警方式Service业务层处理
 * 
 * @author psy
 * @date 2025-04-27
 */
@Service
public class SlopeWarningMethodServiceImpl implements ISlopeWarningMethodService 
{
    @Autowired
    private SlopeWarningMethodMapper slopeWarningMethodMapper;

    /**
     * 查询预警方式
     * 
     * @param id 预警方式主键
     * @return 预警方式
     */
    @Override
    public SlopeWarningMethod selectSlopeWarningMethodById(Long id)
    {
        return slopeWarningMethodMapper.selectSlopeWarningMethodById(id);
    }

    /**
     * 查询预警方式列表
     * 
     * @param slopeWarningMethod 预警方式
     * @return 预警方式
     */
    @DataScope(deptAlias = "s")
    @Override
    public List<SlopeWarningMethod> selectSlopeWarningMethodList(SlopeWarningMethod slopeWarningMethod)
    {
        return slopeWarningMethodMapper.selectSlopeWarningMethodList(slopeWarningMethod);
    }

    /**
     * 新增预警方式
     * 
     * @param slopeWarningMethod 预警方式
     * @return 结果
     */
    @Override
    public int insertSlopeWarningMethod(SlopeWarningMethod slopeWarningMethod)
    {
        slopeWarningMethod.setCreateTime(DateUtils.getNowDate());
        return slopeWarningMethodMapper.insertSlopeWarningMethod(slopeWarningMethod);
    }

    /**
     * 修改预警方式
     * 
     * @param slopeWarningMethod 预警方式
     * @return 结果
     */
    @Override
    public int updateSlopeWarningMethod(SlopeWarningMethod slopeWarningMethod)
    {
        slopeWarningMethod.setUpdateTime(DateUtils.getNowDate());
        return slopeWarningMethodMapper.updateSlopeWarningMethod(slopeWarningMethod);
    }

    /**
     * 批量删除预警方式
     * 
     * @param ids 需要删除的预警方式主键
     * @return 结果
     */
    @Override
    public int deleteSlopeWarningMethodByIds(Long[] ids)
    {
        return slopeWarningMethodMapper.deleteSlopeWarningMethodByIds(ids);
    }

    /**
     * 删除预警方式信息
     * 
     * @param id 预警方式主键
     * @return 结果
     */
    @Override
    public int deleteSlopeWarningMethodById(Long id)
    {
        return slopeWarningMethodMapper.deleteSlopeWarningMethodById(id);
    }
}
